# 导入 requests 包
# import requests

# # 发送请求
# # x = requests.get('https://www.runoob.com/')
# x = requests.get('https://www.baidu.com/')

# # 返回网页内容
# print(x.status_code)  # 获取响应状态码
# print(x.headers)  # 获取响应头
# print(x.content)  # 获取响应内容


# # 导入 requests 包
# import requests

# # 发送请求
# x = requests.get('https://www.runoob.com/')

# # 返回 http 的状态码
# print(x.status_code)

# # 响应状态的描述
# print(x.reason)

# # 返回编码
# print(x.apparent_encoding)



# # 导入 requests 包
# import requests

# # 发送请求
# x = requests.get('https://www.runoob.com/try/ajax/json_demo.json')

# # 返回 json 数据
# print(x.json())




# # 导入 requests 包
# import requests

 
# kw = {'s':'python 教程'}

# # 设置请求头
# headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"}
 
# # params 接收一个字典或者字符串的查询参数，字典类型自动转换为url编码，不需要urlencode()
# response = requests.get("https://www.runoob.com/", params = kw, headers = headers)

# # 查看响应状态码
# print (response.status_code)

# # 查看响应头部字符编码
# print (response.encoding)

# # 查看完整url地址
# print (response.url)

# # 查看响应内容，response.text 返回的是Unicode格式的数据
# # print(response.text)




# # 导入 requests 包
# import requests

# # 发送请求
# x = requests.post('https://www.runoob.com/try/ajax/demo_post.php')

# # 返回网页内容
# print(x.text)


# 导入 requests 包
import requests

# 表单参数，参数名为 fname 和 lname
myobj = {'fname': 'RUNOOB','lname': 'Boy'}

# 发送请求
x = requests.post('https://www.runoob.com/try/ajax/demo_post2.php', data = myobj)

# 返回网页内容
print(x.text)